docs: fixed example code in index-static.html.in
authorRupert Weber <rpwh@gmx.de>
Wed, 1 Sep 2010 16:16:10 +0000 (18:16 +0200)
committerJon Nordby <jononor@gmail.com>
Mon, 28 Mar 2011 22:47:45 +0000 (00:47 +0200)
added babl_init(), fish can't be const, Babl* can't be dereferenced,
one variable name changed during example, added sizeof to make it
a little more obvious.

docs/index-static.html.in

index af6ab1322af483472ed784e5006fdd302a26daa8..9127121bd88454724810da3076b4c743147894e6 100644 (file)
@@ -220,17 +220,19 @@ int width = 123, height = 581, pixel_count = width * height;
 
 const Babl *srgb            = <span class='function'>babl_format</span> <span class='paren'>(</span><span class='string'>"R'G'B' u8"</span><span class='paren'>)</span>;
 const Babl *lab             = <span class='function'>babl_format</span> <span class='paren'>(</span><span class='string'>"CIE Lab float"</span><span class='paren'>)</span>;
-const Babl *rgb_to_lab_fish = <span class='function'>babl_fish</span> <span class='paren'>(</span>srgb, lab);
+Babl       *rgb_to_lab_fish = <span class='function'>babl_fish</span> <span class='paren'>(</span>srgb, lab);
 
 float         *lab_buffer;
 unsigned char *srgb_buffer;
 
-srgb_buffer = malloc (pixel_count * srgb-&gt;format.bytes_per_pixel);
-lab_buffer  = malloc (pixel_count * 3 * 4);
+babl_init <span class='paren'>()</span>;
+
+srgb_buffer = malloc (pixel_count * babl_format_get_bytes_per_pixel (srgb));
+lab_buffer  = malloc (pixel_count * 3 * sizeof (float));
 
 ...... load data into srgb_buffer .......
 
-<span class='function'>babl_process</span> <span class='paren'>(</span>bablfish, srgb_buffer, lab_buffer, pixel_count<span class='paren'>);</span>
+<span class='function'>babl_process</span> <span class='paren'>(</span>rgb_to_lab_fish, srgb_buffer, lab_buffer, pixel_count<span class='paren'>);</span>
 
 ...... do operation in lab space ........